import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot } from '@angular/router';

import { DefaultCreateRouteTabStategy } from './joy-abpui-angular';

@Injectable({
  providedIn: 'root',
})
export class CreateDetailRouteTabStategy extends DefaultCreateRouteTabStategy {
  getRouteTabName(route: ActivatedRouteSnapshot): string {
    var menuname = '详情';
    if (Boolean(route.params?.id)) {
      menuname = `${menuname}:${route.params.id}`;
    } else if (Boolean(route.queryParams?.id)) {
      menuname = `${menuname}:${route.queryParams.id}`;
    }

    return menuname;
  }
}
